#include "cppTutorGlobals.h"
#include "cppTutorOverloadingUnunsualOperators.h"

#include <iostream>

using namespace std;

CcppTutorOverloadingUnunsualOperators unauthor(0, 0, 0);

CcppTutorOverloadingUnunsualOperators :: CcppTutorOverloadingUnunsualOperators ()
{
}

CcppTutorOverloadingUnunsualOperators :: CcppTutorOverloadingUnunsualOperators (int nI, int nJ, int nK) : m_nI(nI), m_nJ(nJ), m_nK(nK) 
{ 
}

CcppTutorOverloadingUnunsualOperators :: ~CcppTutorOverloadingUnunsualOperators ()
{
}


void CcppTutorOverloadingUnunsualOperators :: m_Print() const 
{
    cout << "i = " << m_nI << ", j = " << m_nJ << ", k = "<< m_nK << endl; 
}

t_ptr :: t_ptr(bool f, CcppTutorOverloadingUnunsualOperators* p) : m_bAccess(f), ptr(p)
{
}

CcppTutorOverloadingUnunsualOperators* t_ptr :: operator->()
{
    if (m_bAccess)
    {
        return ptr;
    }
    else 
    {
        cout << "unauthorized access" << endl;
        return &unauthor;
    }
}